package me.aartikov.alligator;


import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.utils.net.Uri;

/**
 * Wrapper for an activity result. It contains a result code and an intent.
 */
public class AbilityResult {
    public static final int RESULT_OK = -1;
    public static final int RESULT_CANCELED = 0;


    private int mResultCode;

    private Intent mIntent;

    public AbilityResult(int resultCode, Intent intent) {
        mResultCode = resultCode;
        mIntent = intent;
    }

    public int getResultCode() {
        return mResultCode;
    }


    public Intent getIntent() {
        return mIntent;
    }


    public Uri getDataUri() {
//		return mIntent != null ? mIntent.getData() : null;
        return mIntent != null ? mIntent.getUri() : null;
    }

    public boolean isOk() {
        return mResultCode == RESULT_OK;
    }

    public boolean isCanceled() {
        return mResultCode == RESULT_CANCELED;
    }
}
